<template>
  <div>

    <div class="chain-link-bar-wrapper">
      <el-breadcrumb separator-class="el-icon-arrow-right">
        <el-breadcrumb-item>系统配置</el-breadcrumb-item>
        <el-breadcrumb-item>订单配置</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
  <el-row>
    <el-col :span="24">

      <el-card class="box-card">
        <div class="app-diliver-10"></div>
        <el-form ref="form" :model="form" label-width="220px">
          <el-form-item label="自动确认收货时间(单位：天)">
            <el-input-number v-model="form.auto_erify_time" :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item label="订单过期时间(单位：秒)">
            <el-input-number v-model="form.out_time"  :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item label="自动打款时间(单位：天)">
            <el-input-number v-model="form.auto_deal_time"  :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item label="待发货超时退款还将按(单位：天)">
            <el-input-number v-model="form.valid_time"  :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item label="退款延迟到账时间(单位：天)">
            <el-input-number v-model="form.refund_into_time"  :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item label="支付费率(单位：千分之)">
            <el-input-number v-model="form.rate"  :min="1" ></el-input-number>
          </el-form-item>
          <el-form-item>
            <SubmitButton
                    type="primary"
                    size=""
                    :ref-form="()=>{return this.$refs['form'];}"
                    :post-option="{url: modifyOrderConfigUrl, data: form, callback: modifyCB }">
              保存
            </SubmitButton>
          </el-form-item>
        </el-form>
      </el-card>
    </el-col>
  </el-row>
  </div>
  
</template>


<script>

  import SubmitButton from '../common/SubmitButton'

  import CommonApi from '../../api/CommonApi'
  import SystemConfig from '../../api/SystemConfig'


  export default {
    components: {
      SubmitButton
    },
    data(){
      return {
        form: {
          id:0,
          auto_erify_time: 1,
          out_time: 1,
          auto_deal_time: 1,
          valid_time: 1,
          refund_into_time: 1,
          rate: 1
        },
        modifyOrderConfigUrl: SystemConfig.URL_MODIFY_ORDER_CONFIG,
      }
    },
    props: ['isShow'],
    computed: {

    },
    created(){
      this.getOrderConfig();
    },
    methods: {
      modifyCB(json){
        this.$message({
          message: '修改成功',
          type: 'success'
        });
      },
      getOrderConfig(){
        SystemConfig.orderConfig(json=>{
          console.log(json)
          this.form = json.orderConfig;
        });
      },
    }
  }
</script>

